﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ServicesComponent.Repositories;

public partial class QuanLyNhanVien_NhanVien : System.Web.UI.Page
{
    public int id = 1;
    private static INhanVienRepository _NhanVienRepository; 
    protected void Page_Load(object sender, EventArgs e)
    {
        id = id + 1;
        if (!IsPostBack)
        {
            if (Request.QueryString["Refresh"] != null)
            {
                _NhanVienRepository = FactoryServices.GetServicesNhanVien(_NhanVienRepository);
                Bind();
                return;
            }
            if (Request.QueryString["Page"] != null)
            {
                id = (int.Parse(Request.QueryString["Page"].ToString()) - 1) * 14 + 1;
            }
        }
        _NhanVienRepository = FactoryServices.GetServicesNhanVien(_NhanVienRepository);
        Bind();
    }
    void Bind()
    {
        rptA.Dispose();
        // rptA.RenderControl("f");
        rptA.DataSource = null;
        //   rptA.BeginResetItemTemplate();
        rptA.DataSource = _NhanVienRepository.GetNhanVienBySchoolId(int.Parse(Session["SchoolID"].ToString()));

        rptA.DataBind();
        Cpage.DataSource = _NhanVienRepository.GetNhanVienBySchoolId(int.Parse(Session["SchoolID"].ToString()));
        Cpage.BindToControl = rptA;
        rptA.DataSource = Cpage.DataSourcePaged;
        // drAddress.EndResetItemTemplate()

    }
}